import { Controller, Get, Post, UseGuards, Request} from '@nestjs/common';
import { AuthGuard } from '@nestjs/passport';
import { AppService } from './app.service';
import { AuthService } from './auth/auth.service';

@Controller()
export class AppController {
  constructor(private readonly authService: AuthService) {}

  // @Get()
  // getHello(): string {
  //   return this.appService.getHello();
  // }

  @UseGuards(AuthGuard('local'))
  @Post('auth')
  async login(@Request() req) {
    console.log(req.user)
    return this.authService.login(req.user);
  }

  @UseGuards(AuthGuard('jwt'))
  @Post('extendAuth')
  async extendAuth(@Request() req) {
    console.log(req.user)
    return this.authService.extend(req.user);
  }
  
}
